﻿Public Class clsInhGrupaMaszyny
    Inherits clsGrupaMaszyny

#Region "Attributes"
    Dim mvarGrupaMaszyny As New Collection(Of clsGrupaMaszyny)
#End Region

#Region "Properties"

    Public Property GrupaMaszyn() As Collection(Of clsGrupaMaszyny)
        Get
            Return mvarGrupaMaszyny
        End Get
        Set(ByVal value As Collection(Of clsGrupaMaszyny))
            mvarGrupaMaszyny = value
        End Set
    End Property

#End Region

#Region "Methods"

    Public Sub New()
        mvarGrupaMaszyny = New Collection(Of clsGrupaMaszyny)
    End Sub

    Public Sub New(ByVal ID As Integer, ByVal lvarDbHolder As clsDataBase)

        MyBase.New(CStr(ID), lvarDbHolder, VAR_ERROR_HANDLER)

    End Sub


    Public Sub Szukaj(ByVal lvarDbHolder As clsDataBase, ByVal Zapytanie As String)

        Dim lvarReader As OdbcDataReader = Nothing
        If lvarDbHolder.IsOpen Then
            Dim lvarSqlRunner As New clsSqlRunner(lvarDbHolder, "queries_application_oem", "cls_grupa_maszyny", 1, VAR_ERROR_HANDLER)
            With lvarSqlRunner
                .AddParameter("p_zapytanie", Zapytanie)
                lvarReader = .ExecuteQuery
            End With

            If lvarReader.HasRows Then
                While lvarReader.Read
                    mvarGrupaMaszyny.Add(New clsGrupaMaszyny(CStr(IIf(IsDBNull(lvarReader.Item("id")), -1, lvarReader.Item("id"))), lvarDbHolder, VAR_ERROR_HANDLER))
                End While
            End If
        End If

    End Sub

#End Region

End Class
